<?php

namespace App\Http\Requests\V3_2_7;

use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;

class ShelfLocationTagRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize(): bool
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules(): array
    {
        return [
            'tag_name' => 'required|max:50',
            'sort'=>'nullable|integer',
            'type'=>['required',Rule::in([0,1])]
        ];
    }
    /**
     * 验证错误信息.
     *
     * @return array
     */
    public function messages(): array
    {
        return [
            'tag_name.required' => '标题不能为空！',
            'tag_name.max' => '标题字数不能超过50个！',
            'sort.integer' => '排序为整数！',
            'type.required' => '类型,不能为空',
            'type.in' => '类型错误！',
        ];
    }
}
